<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreatePushMessageTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('push_message', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title',100)->comment('标题');
            $table->text('body')->comment('内容');
            $table->string('push_target')->comment('DEVICE:根据设备推送;ACCOUNT:根据账号推送;ALIAS:根据别名推送;TAG:根据标签推送;ALL:推送给全部设备');
            $table->text('push_target_value')->comment('全员推送为ALL;部分推送为英文逗号分隔的相应值字符串');
            $table->string('push_device_type')->comment('iOS/ANDROID/ALL');
            $table->unsignedTinyInteger('status')->default(0)->comment('推送状态0未开始1推送中2已推送,3推送失败');
            $table->timestamps();
        });

        Schema::create('push_message_record', function (Blueprint $table) {
            $table->increments('id');
            $table->string('title',100)->comment('标题');
            $table->text('body')->comment('内容');
            $table->string('push_target')->comment('DEVICE:根据设备推送;ACCOUNT:根据账号推送;ALIAS:根据别名推送;TAG:根据标签推送;ALL:推送给全部设备');
            $table->text('push_target_value')->comment('全员推送为ALL;部分推送为英文逗号分隔的相应值字符串');
            $table->string('push_device_type')->comment('iOS/ANDROID/ALL');
            $table->unsignedTinyInteger('status')->default(0)->comment('推送状态0未开始1推送中2已推送');
            $table->string('message_id',50)->nullable()->comment('标志一次推送的消息ID');
            $table->timestamps();
        });


    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('push_message');
        Schema::dropIfExists('push_message_record');
    }
}
